// 指令 {}
export default {
  bind: function(el, binding) {
    const options = binding.value;
    
    const { className, activeClass, currentIndex } = options;
    const children = el.getElementsByClassName(className);
    children[currentIndex].className += ` ${activeClass}`;
  },
  update: function(el, binding) {
    const options = binding.value;
    const oldOptions = binding.oldValue;
    
    const { className, activeClass, currentIndex } = options;
    const children = el.getElementsByClassName(className);
    const { currentIndex: oldCurIndex } = oldOptions;
    children[currentIndex].className += ` ${activeClass}`;
    children[oldCurIndex].className = className;
  }
}